package org.itzheng.yuezhi.utils;

import android.util.Log;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;

/**
 * Title:使用jsoup对html进行操作,保存文章,获取图片等<br>
 * Description: <br>
 * Company: <br>
 *
 * @author ZhengYongdong
 * @email ItZheng@ZoHo.com
 * @date 2016/7/7 0007
 */
public class MyJsoup {
    private static final String TAG = "MyJsoup";

    public void getHtml(String url) {
        MyLog.i(TAG, "url " + url);
        Document document = null;
        try {
            //连接网络,获取信息
            document = Jsoup.connect(url).get();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (document == null) {
            Log.e(TAG, "document == null");
        } else {
            MyLog.d(TAG, "title() " + document.title());
            MyLog.d(TAG, "body() " + document.body());
            MyLog.d(TAG, "location() " + document.location());
        }
    }
}
